package com.serviceImpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.bean.PurchaseOrder;
import com.bean.PurchaseOrderMaterial;
import com.mapper.PurchaseOrderMapper;
import com.mapper.PurchaseOrderMaterialMapper;
import com.service.PurchaseOrderService;

/**
 * @author  author : 张鹏
 * @date createTime：2018年1月25日 下午5:35:57 
 * @Description: 该类的功能描述
 */
@Service
public class PurchaseOrderServiceImpl implements PurchaseOrderService {
	@Resource
	private PurchaseOrderMapper orderMapper;
	
	@Resource
	private PurchaseOrderMaterialMapper purchaseOrderMaterialMapper;
	
	@Override
	public List<PurchaseOrderMaterial> getSumMaterialQuantity() {
		// TODO Auto-generated method stub
		return purchaseOrderMaterialMapper.selectSumMaterialQuantity();
	}
	
	@Override
	public List<PurchaseOrder> selectAll() {
		// TODO Auto-generated method stub
		return orderMapper.selectAll();
	}

	@Override
	public PurchaseOrder selectByPrimaryKey(int id) {
		// TODO Auto-generated method stub
		return orderMapper.selectByPrimaryKey(id);
	}

	@Override
	public int insert(PurchaseOrder p) {
		// TODO Auto-generated method stub
		return orderMapper.insert(p);
	}

	@Override
	public int deleteByPrimaryKey(int id) {
		// TODO Auto-generated method stub
		return orderMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int exame(PurchaseOrder p) {
		// TODO Auto-generated method stub
		return orderMapper.updateByExame(p);
	}

	@Override
	public List<PurchaseOrder> selectByState(int state) {
		// TODO Auto-generated method stub
		return orderMapper.selectByState(state);
	}

	@Override
	public int sendMaterial(PurchaseOrder p) {
		return orderMapper.updateBySend(p);
	}

	@Override
	public int receiveMaterial(PurchaseOrder p) {
		return orderMapper.updateByReceive(p);
	}

	@Override
	public List<PurchaseOrder> selectByFinish(int finish) {
		// TODO Auto-generated method stub
		return orderMapper.selectByFinish(finish);
	}

	@Override
	public List<PurchaseOrder> selectByStateAndSupplierId(PurchaseOrder p) {
		// TODO Auto-generated method stub
		return orderMapper.selectByStateAndSupplierId(p);
	}

	@Override
	public List<PurchaseOrder> selectBySupplierId(int supplierId) {
		// TODO Auto-generated method stub
		return orderMapper.selectBySupplierId(supplierId);
	}

}
